/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include <lib3d/Light.h>
#include <lib3d/material/TextureSimple.h>
#include "Node.h"

namespace liba {
namespace lib3d {
namespace node {

class Light : public Node
{
	NODE_DEFINITION(Light)
public:
	static const Atom node_name;

	Light( const Atom & name, Node * parent );
	Light(const Light& rhs);
	virtual Light * clone();
	virtual ~Light();

	// Attributes...
	static const Atom diffuse_name;
	static const Atom ambient_name;
	static const Atom specular_name;
	static const Atom intensity_name;

//	bool push_in_hardware( hard::Hardware * hardware, const CameraDesc & camera_desc )const;
	virtual void render_to_list( hard::Hardware * hardware, hard::RenderList * render_list );

/*	double get_range()const
	{
		return range;
	}*/
protected:
	virtual bool on_attribute( xml::Provider * prov, const std::string & name, const std::string & value );
	virtual bool on_node( xml::Provider * prov, const std::string & name );
	virtual bool on_end_node( xml::Provider * prov );
private:
	bool is_infinite()const;
	double GetIntensity();
	void SetIntensity(double value);
	properties::VirtualDependencyProperty<double> intensity;

	const Color& GetAmbient();
	void SetAmbient(const Color& value);
	properties::VirtualDependencyProperty<Color> ambient;

	const Color& GetDiffuse();
	void SetDiffuse(const Color& value);
	properties::VirtualDependencyProperty<Color> diffuse;

	const Color& GetSpecular();
	void SetSpecular(const Color& value);
	properties::VirtualDependencyProperty<Color> specular;

	lib3d::Light hardware_light;
//	double range;
	void on_change_parameters();
};

} // namespace node
} // namespace lib3d
} // namespace liba
using namespace liba;

